﻿<%@ WebHandler Language="C#" Class="SysLog_GetByPage" %>

using System;
using System.Web;
using System.Text;
using Newtonsoft.Json;
public class SysLog_GetByPage : IHttpHandler , System.Web.SessionState.IReadOnlySessionState
{
    
    public void ProcessRequest (HttpContext context) 
    {
        OTS.Common.Page<OTS.Model.Consulting> page = new OTS.Common.Page<OTS.Model.Consulting>();
        if (!OTS.BaseLogin.validataModule(context, (int)OTS.enumSysRight.Consult))
        {
            page.success = false;
            page.msg = "非法操作！";
        }
        else
        {
            string limit = context.Request["limit"];
            string start = context.Request["start"];
            string status = context.Request["status"];
            //string realname = context.Request["realname"];
 
            int limitInt = 20;
            int startInt = 0;
            if (null != limit && OTS.Common.Help.IsNumber(limit)) limitInt = int.Parse(limit);
            if (null != start && OTS.Common.Help.IsNumber(start)) startInt = int.Parse(start);
            //if (null == realname) realname = "";
            OTS.BLL.ConsultingBLL bll = new OTS.BLL.ConsultingBLL();
            string strWhere = "";
            if (status == "0") //未回复
            {
                strWhere = " replyCount=0";
            }
            else if(status=="1") //已回复
            {
                strWhere = " replyCount>0";
            }
            page = bll.GetListByPage(startInt, limitInt, strWhere);
        } 
        context.Response.ContentType = "application/x-json";
        context.Response.Charset = "utf-8";
        context.Response.Write(JavaScriptConvert.SerializeObject(page));
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}